﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using MVCDemo.Models;

namespace MVCDemo.Data
{
    public class DataInitlizer:DropCreateDatabaseIfModelChanges<MVCDemoDb>
    {
        protected override void Seed(MVCDemoDb db)
        {
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="xiaoyou",
                    Password="111"
                },new Users
                {
                    Username="xiaoai",
                    Password="111"
                },new Users
                {
                    Username="天人",
                    Password="111"
                },new Users
                {
                    Username="孤游林海",
                    Password="111"
                },
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="又变可爱了"
                },new Messages
                {
                    FromUserId=2,
                    Content="太开心了"
                },new Messages
                {
                    FromUserId=3,
                    Content="自由世界"
                },new Messages
                {
                    FromUserId=4,
                    Content="听海哭的声音"
                },new Messages
                {
                    FromUserId=4,
                    Content="听微风吹过柳梢"
                },new Messages
                {
                    FromUserId=2,
                    Content="爱恨情仇"
                },new Messages
                {
                    FromUserId=2,
                    Content="美丽中国"
                },new Messages
                {
                    FromUserId=3,
                    Content="嘻嘻"
                },new Messages
                {
                    FromUserId=1,
                    Content="花开花谢"
                },
            });


            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId=1,
                    MsgId=9,
                    Comment="哈哈！"
                },new Comments
                {
                    FromUserId=4,
                    MsgId=7,
                    Comment="嘻嘻"
                },new Comments
                {
                    FromUserId=3,
                    MsgId=8,
                    Comment="又是开心的一天"
                },new Comments
                {
                    FromUserId=2,
                    MsgId=6,
                    Comment="！！！！！！！！！！！"
                },new Comments
                {
                    FromUserId=3,
                    MsgId=4,
                    Comment="海浪朝你打来"
                },new Comments
                {
                    FromUserId=1,
                    MsgId=1,
                    Comment="aklfajljf"
                },
            });



            db.SaveChanges();


            base.Seed(db);
        }
    }
}